﻿package net.wangit.view.unit.component;

import java.util.ArrayList;
import java.util.List;

import net.wangit.view.element.ElementComponent;
import net.wangit.view.util.Html;


public class Frameset extends Frame {

	private List<Frame> frames;

	public Frameset() {
		frames = new ArrayList<Frame>();
	}

	public void add(Frame frame) {
		frames.add(frame);
	}

	public void write(StringBuffer html) {
		ElementComponent first = ((Frame) frames.get(0)).getElement();
		html.append("<frameset");
		Html.setAttribute(html, first.getTdAttribute());
		html.append(">");
		writeFrames(html);
		html.append("</frameset>");
	}

	public void writeFrames(StringBuffer html) {
		for (int i = 0; i < frames.size(); i++)
			frames.get(i).write(html);

	}
}
